"""
example01 - 保存5个学生，3门课程的成绩

Author: Administrator
Date: 2024/1/10
"""
import random

names = ['刘一', '陈二', '张三', '李四', '王五', '赵六', '孙七']
courses = ['语文', '数学', '英语']
scores = [[random.randrange(50, 101) for _ in range(len(courses))]
          for _ in range(len(names))]

# for i, name in enumerate(names):
#     for j, course in enumerate(courses):
#         print(f'{name}的{course}成绩：{scores[i][j]}')

# 统计每个学生的平均成绩
for i, name in enumerate(names):
    print(f'{name}平均成绩：{sum(scores[i])/3:.1f}')

# 统计每门课的最高分和最低分
for j, course in enumerate(courses):
    temp = [scores[i][j] for i in range(len(names))]
    print(f'{course}的最高分：{max(temp)}')
    print(f'{course}的最低分：{min(temp)}')